<?php

/**
 * Utilisateur filter form base class.
 *
 * @package    jobeat
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseUtilisateurFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'attrnom'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'attrprenom'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'attremail'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'attrmdp'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'attrdroit'            => new sfWidgetFormChoice(array('choices' => array('' => '', 'Utilisateur' => 'Utilisateur', 'Administrateur' => 'Administrateur'))),
      'attrupload'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'attrdownload'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'attrongletmodifier'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'attrongletoutils'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'attrongletadmin'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'attrisfirstconnexion' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'attrcomptevalid'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
    ));

    $this->setValidators(array(
      'attrnom'              => new sfValidatorPass(array('required' => false)),
      'attrprenom'           => new sfValidatorPass(array('required' => false)),
      'attremail'            => new sfValidatorPass(array('required' => false)),
      'attrmdp'              => new sfValidatorPass(array('required' => false)),
      'attrdroit'            => new sfValidatorChoice(array('required' => false, 'choices' => array('Utilisateur' => 'Utilisateur', 'Administrateur' => 'Administrateur'))),
      'attrupload'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'attrdownload'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'attrongletmodifier'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'attrongletoutils'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'attrongletadmin'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'attrisfirstconnexion' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'attrcomptevalid'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('utilisateur_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Utilisateur';
  }

  public function getFields()
  {
    return array(
      'id'                   => 'Number',
      'attrnom'              => 'Text',
      'attrprenom'           => 'Text',
      'attremail'            => 'Text',
      'attrmdp'              => 'Text',
      'attrdroit'            => 'Enum',
      'attrupload'           => 'Number',
      'attrdownload'         => 'Number',
      'attrongletmodifier'   => 'Number',
      'attrongletoutils'     => 'Number',
      'attrongletadmin'      => 'Number',
      'attrisfirstconnexion' => 'Number',
      'attrcomptevalid'      => 'Number',
    );
  }
}
